package com.itheima.spring;

import com.itheima.spring.config.HmConfig;
import com.itheima.spring.config.HmMybatisConfig;
import com.itheima.spring.dao.UserMapper;
import com.itheima.spring.pojo.User;
import com.itheima.spring.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author ：sean
 * @date ：Created in 2020/7/5
 * @description ：
 * @version: 1.0
 */
public class MybatisApp {
	public static void main(String args[]){
		// 初始化上下文容器
		AnnotationConfigApplicationContext applicationContext
			= new AnnotationConfigApplicationContext(HmMybatisConfig.class);
		// 通过容器获取对象
		UserMapper userMapper = applicationContext.getBean(UserMapper.class);
		System.out.println(userMapper);
		User username = userMapper.findByUsername("admin");
		System.out.println(username.getEmail());
	}
}
